package bagu.juc;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerExample {
    public static void main(String[] args) {
        AtomicInteger atomicInt = new AtomicInteger();

        System.out.println(atomicInt.incrementAndGet());

        boolean success = atomicInt.compareAndSet(1, 2);
        if (success)
            System.out.println(atomicInt.get());
    }
}
